package co.edu.uniandes.distribuidos.exclusion.downloadContainer;

import java.util.ArrayList;
import java.util.List;

public class DownloadFileContainer {
	
	private List<DownloadFile> listDownloadFile=new ArrayList<DownloadFile>();

	

	public List<DownloadFile> getListDownloadFile() {
		return listDownloadFile;
	}

	public void setListDownloadFile(List<DownloadFile> listDownloadFile) {
		this.listDownloadFile = listDownloadFile;
	}

	public boolean add(DownloadFile e) {
		return listDownloadFile.add(e);
	}

	public boolean remove(DownloadFile ev) {
		return listDownloadFile.remove(ev);
	}

	public boolean isEmpty() {
		return listDownloadFile.isEmpty();
	}

	public DownloadFile get(String fileID) {
		DownloadFile retorno =null;
		for (DownloadFile df: listDownloadFile){
			if (df.getFileAdvertisement().getFileID().toString().equals(fileID))
				retorno = df;
		}
		return retorno;
	}

	public void removeAll() {
		listDownloadFile.clear();
	}

}
